home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-06-30 | 3.0 KB | 80 lines |
- /*
- * @(#)AbstractBorder.java 1.17 98/02/02
- *
- * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
- *
- * This software is the confidential and proprietary information of Sun
- * Microsystems, Inc. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Sun.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
- * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
- * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
- * THIS SOFTWARE OR ITS DERIVATIVES.
- *
- */
- package com.sun.java.swing.border;
-
- import java.awt.Graphics;
- import java.awt.Insets;
- import java.awt.Rectangle;
- import java.awt.Component;
- import java.io.Serializable;
-
- /**
- * A class which implements an empty border with no size.
- * This provides a convenient base class from which other border
- * classes can be easily derived.
- * <p>
- * Warning: serialized objects of this class will not be compatible with
- * future swing releases. The current serialization support is appropriate
- * for short term storage or RMI between Swing1.0 applications. It will
- * not be possible to load serialized Swing1.0 objects with future releases
- * of Swing. The JDK1.2 release of Swing will be the compatibility
- * baseline for the serialized form of Swing objects.
- *
- * @version 1.17 02/02/98
- * @author David Kloba
- */
- public abstract class AbstractBorder implements Border, Serializable
- {
-
- /** This default implementation does no painting. */
- public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
- }
-
- /** This default implementation returns the value of getBorderMargins. */
- public Insets getBorderInsets(Component c) {
- return new Insets(0, 0, 0, 0);
- }
-
- /** This default implementation returns false. */
- public boolean isBorderOpaque() { return false; }
-
- /** This is a convience method that calls the static method. */
- public Rectangle getInteriorRectangle(Component c, int x, int y, int width, int height) {
- return getInteriorRectangle(c, this, x, y, width, height);
- }
-
- /** This method returns a rectangle using the arguements minus the
- * insets of the border. This is useful for determining the area
- * that components should draw in that will not intersect the border.
- */
- public static Rectangle getInteriorRectangle(Component c, Border b, int x, int y, int width, int height) {
- Insets insets;
- if(b != null)
- insets = b.getBorderInsets(c);
- else
- insets = new Insets(0, 0, 0, 0);
- return new Rectangle(x + insets.left,
- y + insets.top,
- width - insets.right - insets.left,
- height - insets.top - insets.bottom);
- }
-
- }
-